namespace one {
    export function setTimeout(call:()=>void, delay:number):number {
        if (egret.Capabilities.runtimeType == egret.RuntimeType.WEB) {
            return window.setTimeout(call, delay);
        }
        else {
            return egret.setTimeout(call, null, delay);
        }
    }

    export function clearTimeout(timeID:number):void {
        if (egret.Capabilities.runtimeType == egret.RuntimeType.WEB) {
            return window.clearTimeout(timeID);
        }
        else {
            return egret.clearTimeout(timeID);
        }
    }

    export function setInterval(call:()=>void, delay:number):number {
        if (egret.Capabilities.runtimeType == egret.RuntimeType.WEB) {
            return window.setInterval(call, delay);
        }
        else {
            return egret.setInterval(call, null, delay);
        }
    }

    export function clearInterval(timeID:number):void {
        if (egret.Capabilities.runtimeType == egret.RuntimeType.WEB) {
            return window.clearInterval(timeID);
        }
        else {
            return egret.clearInterval(timeID);
        }
    }

    export function callLater(call:()=>void, frame:number):void {
        let f = ()=> {
            if (frame <= 0) {
                call();
                return;
            }

            frame--;
            egret.callLater(f, null);
        }

        frame--;
        egret.callLater(f, null);
    }
}